<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul li{
            height:50px;
            width: 100px;
            margin: 2px;
            list-style: none;
        }

        ul li:first-child{
            background-color: skyblue;
        }

        ul li:last-child{
            background-color: pink;
        }

        ul li:nth-child(2){
            background-color: gold;
        }

        /* nth-child选择器可以选择某个父元素的一个或多个特定的子元素 */
        ol li{
            height:50px;
            width: 100px;
            margin: 2px;
            list-style: none;
        }

        ol li:nth-child(even){
            background-color: red;
        }

        ol li:nth-child(odd){
            background-color: blue;
        }

        /* ol li:nth-child(n){
            background-color: yellow;
        } */

        /* ol li:nth-child(2n){
            background-color: yellow;
        } */

        /* child和type */
        div p,div{
            height:50px;
            width: 100px;
            margin: 2px;
            background-color: pink;
        }

        /* 可打开下面的两个标签试着对比 */
        div div:first-child{
            background-color: blue;
        }

        /* div div:first-of-type{
            background-color: blue;
        } */
    </style>
</head>
<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
    <ol>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ol>
    <div>
        <p></p>
        <div></div>
    </div>
</body>
</html>